Communication device, RFID system, and recordable medium having data writing program recorded thereon

ABSTRACT

A communication device ( 3 ) performs contactless communication with an RF tag ( 8 ) that is provided with a nonvolatile memory ( 82 ) having a plurality of blocks serving as units of data erasure. The communication device ( 3 ) includes a specifying unit ( 303 ) that specifies, from among blocks to which a writing range belongs, a divided block that includes data outside the writing range when data is written into the nonvolatile memory, a backup processing unit ( 304 ) that backs up original data of the specified divided block, a storage unit ( 36 ) that stores backup data that includes the original data, and a writing processing unit ( 305 ) that writes the update data into the divided block that was initialized when the backup data is stored.

TECHNICAL FIELD

The present invention relates to a communication device, an RFID (RadioFrequency IDentification) system, and a recording medium having a datawriting program recorded thereon, and particularly relates to acommunication device that performs contactless communication with anRFID tag (hereinafter, referred to as “RF tag”) that is provided with anonvolatile memory having a plurality of blocks serving as units of dataerasure, to an RFID system including the communication device and the RFtag, and to a recording medium having recorded thereon a data writingprogram that is executed by the communication device.

RELATED ART

In recent years, in various fields, information management using RF tagsis conducted. A commonly-used RFID system includes an RF tag that isattached to an article to be managed or an object (such as a pallet orcontainer) that supports or accommodates the article, a reader/writerthat serves as a communication device for performing communicationprocessing with the RF tag, and a host device that controls thereader/writer. The reader/writer performs reading and writing of datafrom and into the nonvolatile memory in the RF tag in accordance with acommand from the host device, and sends the processing result back tothe host device.

Because the reader/writer performs contactless communication with the RFtag, there may be cases where the communication is interrupted whiledata is rewritten. JP 2001-22653A (Patent Document 1) discloses aconfiguration that backs up data on the RF tag side in order to preventsuch a situation.

With regard to the data backup, JP 4300255B (Patent Document 2)discloses that an RF tag including a module for communicating with awireless base station automatically detects the interruption of thecommunication with the reader/writer and performs backup communicationwith the wireless base station.

RELATED ART DOCUMENTS Patent Documents

Patent Document 1: JP 2001-22653A

Patent Document 2: JP 4300255B

SUMMARY OF THE INVENTION Problem to be Solved by the Invention

Commonly, an RF tag is provided with a nonvolatile memory such as aflash memory in which data is to be erased in units of a block (i.e.block by block). Therefore, if data is written into such a nonvolatilememory, even when data is written only into a part of a block,initialization (data erasure) of the entire block, serving as a writingdestination, is first performed and then update data is written.Accordingly, if the communication is interrupted during the writing ofdata into the RF tag due to some sort of reason (for example, when theRF tag moves to a region in which it cannot be supplied with anoperating electric power or the like), there is a risk that the originaldata of the block serving as a writing destination is lost.

Since the above-described conventional backup methods require changinghardware configuration of the RF tag or the environment of the system,realization thereof is expensive.

The present invention was made in order to solve the foregoing problems,and it is an object thereof to provide a communication device, an RFIDsystem, and a recording medium having a data writing program recordedthereon that can prevent a complete data loss by a simple method.

Means for Solving the Problems

According to an aspect of the present invention relates to acommunication device that performs contactless communication with an RFtag that is provided with a nonvolatile memory having a plurality ofblocks serving as units of data erasure, including: a specifying unitthat specifies, from among blocks to which a writing range belongs, ablock that includes data outside the writing range when data is writteninto the nonvolatile memory; a backup processing unit that backs uporiginal data of the block specified by the specifying unit; a storageunit that stores backup data that includes the original data; and awriting processing unit that writes, when the backup data is stored inthe storage unit, update data into the block that was specified andinitialized.

It is preferable that the original data included in the backup data bedata that is read by the writing processing unit from the specifiedblock before the initialization.

It is preferable that the communication device further include: awriting-back processing unit that reads the backup data stored in thestorage unit and writes the original data back into the specified blockof the nonvolatile memory, if writing into the specified block hasfailed.

It is preferable that the communication device further include: anotification unit that performs, if writing into the specified block hasfailed, notification of error information indicating a possibility of adata loss, wherein the writing-back processing unit writes the originaldata back into the specified block in response to a writing-backinstruction from a user.

It is preferable that the communication device further include: anelectric power supply unit, wherein the storage unit further storespredetermined information during writing processing by the writingprocessing unit, the notification unit further performs, when theelectric power supply unit is turned on, notification of the errorinformation if the predetermined information is stored in the storageunit.

It is preferable that the notification unit perform notification of theerror information such that a data loss caused by a communicationfailure and a data loss caused by an electric power interruption aredistinguished from each other.

It is preferable that the notification unit transmit the errorinformation to a host device connected by a cable or wirelessconnection.

It is preferable that the communication device further include: adetection unit that detects the RF tag, and acquires identificationinformation of the detected RF tag, wherein the backup processing unitstores the identification information of the RF tag and the backup datain association with each other, and the writing-back processing unitwrites the original data back into the specified block in response to awriting-back instruction, if the identification information of thedetected RF tag and the identification information associated with thebackup data match each other.

According to another aspect of the present invention relates to an RFIDsystem including the communication device having any one of theabove-described features, and the RF tag.

According to a further aspect of the present invention relates to arecording medium having a data writing program for writing data into anonvolatile memory of an RFID tag recorded thereon, the nonvolatilememory having a plurality of blocks serving as units of data erasure,the data writing program being executed by a communication device thatperforms contactless communication with the RF tag. The data writingprogram includes the steps of specifying, from among blocks to which awriting range belongs, a block that includes data outside the writingrange when data is written into the nonvolatile memory; storing backupdata that includes original data of the specified block into a storageunit; and writing, when the backup data is stored in the storage unit,update data into the block that was specified and initialized.

Effects of the Invention

According to the present invention, it is possible to prevent a completedata loss by a simple method.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram schematically illustrating a configuration of anRFID system according to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a hardware configuration of areader/writer according to the embodiment of the present invention.

FIG. 3 is a block diagram illustrating a hardware configuration of an RFtag according to the embodiment of the present invention.

FIG. 4 is a block diagram illustrating an example of a hardwareconfiguration of a host device according to the embodiment of thepresent invention.

FIG. 5 is a functional block diagram illustrating a functionalconfiguration of the RFID system according to the embodiment of thepresent invention.

FIG. 6 is a diagram schematically illustrating the relationship betweena writing range and the block configuration of a flash memory providedin the RF tag according to the embodiment of the present invention.

FIG. 7 is a diagram illustrating an example of a data structure ofrestoration information according to the embodiment of the presentinvention.

FIG. 8 is a flowchart illustrating data writing processing that isexecuted by the reader/writer according to the embodiment of the presentinvention.

FIG. 9 is a flowchart illustrating error notification processing that isexecuted in the host device according to the embodiment of the presentinvention.

FIG. 10 is a flowchart illustrating restoration processing that isexecuted by the reader/writer according to the embodiment of the presentinvention.

FIG. 11 is a flowchart illustrating data writing processing that isexecuted by a reader/writer, according to a modification of theembodiment of the present invention.

FIG. 12 is a flowchart illustrating processing for starting thereader/writer according to the modification of the embodiment of thepresent invention.

EMDODIMENTS OF THE INVENTION

Hereinafter, an embodiment of the present invention will be described indetail with reference to the drawings. Note that the same referencenumerals are given to the same or equivalent parts in the drawings, anddescriptions thereof are not repeated.

An RFID system according to the present embodiment is used, for example,in a production line of a factory and the like so as to manageinformation on workpieces that are conveyed on a conveying path.

<About Configuration>

Schematic System Configuration

First, a schematic configuration of the RFID system according to thepresent embodiment will be described.

FIG. 1 is a diagram schematically illustrating a configuration of anRFID system SYS according to the embodiment of the present invention. Asshown in FIG. 1, the RFID system SYS includes a host device 1, areader/writer 3, which serves as a communication device, and an RF tag8.

The host device 1 is a control device that performs overall control ofreading/writing of information from/into the RF tag 8. The host device 1is realized by, for example, a personal computer or a PLC (ProgrammableLogic Controller). The host device 1 is connected to the reader/writer 3via a hub 2, and communicates with the reader/writer 3. The hub 2 is,for example, an Ethernet (registered trademark) hub. The reader/writer 3executes communication with the RF tag 8 and reading/writing ofinformation from/into the RF tag 8, in accordance with a command fromthe host device 1. Note that although in the present embodiment, thehost device 1 and the reader/writer 3 are assumed to be connected toeach other by a cable connection, they may be connected to each other bya wireless connection.

Here, there is a case where on a conveying path, the position of the RFtag 8 changes due to rotation of a pallet or a container while thereader/writer 3 and the RF tag 8 communicate with each other. There isalso a case where the conveying speed of a workpiece during thecommunication is not appropriate. In cases like these, communication maybe interrupted while data is written into the RF tag 8. If the RF tag 8is provided with, for example, a flash memory, the original data iserased (initialization) in units of a block before data is written.Accordingly, if communication is interrupted after the erasure, theoriginal data will be lost. If data of the entire block is to berewritten, a user needs only to write new data (udate data) again, andthus even a loss of the original data does not pose a problem. Incontrast, if data is to be written only into a part of a block, a lossof the original data is disadvantageous because the original data of theblock is also needed. In the present embodiment, therefore, only theoriginal data of a block a part of which data is to be written into isbacked up in the reader/writer 3.

Hardware Configurations of Devices

Hereinafter, examples of hardware configurations of the devices includedin the RFID system SYS will be described.

FIG. 2 is a block diagram illustrating a hardware configuration of thereader/writer 3 according to the embodiment of the present invention.FIG. 3 is a block diagram illustrating a hardware configuration of theRF tag 8 according to the embodiment of the present invention.

As shown in FIG. 2, the reader/writer 3 is constituted by an antennaunit 70 including an antenna coil 71, and a communication control device30 including a control unit 31. Note that this configuration is merelyan example, and the antenna unit 70 and the communication control device30 may also be formed in one piece.

The communication control device 30 includes, in addition to the controlunit 31, a transmitting circuit 32, a receiving circuit 33, a receptionlevel detecting circuit 34, a communication interface (I/F) 35, astorage unit 36, a timer unit 37, a display unit 38, and an electricpower supply unit 39.

The control unit 31 is realized by an arithmetic processing unit such asa CPU (Central Processing Unit). An Ethernet (registered trademark)cable is connected to the communication I/F 35, andtransmission/reception of information to/from the host device 1 isperformed. The storage unit 36 stores various types of programs and datain a nonvolatile manner. The storage unit 36 may be, for example, aflash memory. The timer unit 37 measures a time, and outputs measuredtime data to the control unit 31. The display unit 38 displays varioustypes of information in accordance with an instruction from the controlunit 31. The display unit 38 may be configured by LED (Light EmittingDiode) lamps.

The transmitting circuit 32 is constituted by a drive circuit 41, amodulation circuit 42, a multiplication circuit 43, an amplifier circuit45, and a pair of Z conversion circuits 44 and 46 that sandwich theamplifier circuit. The receiving circuit 33 is constituted by aband-pass filter (BPF) circuit 51, a detector circuit 52, a low-passfilter (LPF) circuit 53, an amplifier circuit 54, a comparator 55, andthe like. The reception level detecting circuit 34 is constituted by adetector circuit 61 and an A/D (Analog to Digital) conversion circuit62.

Note that the communication control device 30 is assumed to include anoscillator circuit (not shown) that outputs a high-frequency pulse,which serves as a carrier signal.

In the above-described configuration, the control unit 31 outputs, basedon a pulse signal from the oscillator circuit (not shown), ahigh-frequency pulse (hereinafter, referred to as a “carrier signal”),which serves as the origin of a carrier wave. Furthermore, the controlunit 31 suitably outputs a command signal of a given bit number. Thecarrier signal, after having been converted into the carrier wave by thedrive circuit 41, is subjected to impedance matching processingperformed by the Z conversion circuits 44 and 46 and to amplificationprocessing performed by the amplifier circuit 45, so as to be suppliedto the antenna coil 71 and transmitted outward as an electromagneticwave. Furthermore, by the modulation circuit 42 and the multiplicationcircuit 43 modulating the amplitude of the carrier wave in accordancewith the command signal, the command signal is superimposed on thecarrier wave.

When the electromagnetic wave is transmitted outward from the antennacoil 71 in the above-described processing, an induced electromotiveforce is generated in the RF tag 8 present in a communication region dueto this electromagnetic wave, and a control unit 81 (FIG. 3) on the RFtag 8 side is activated. If in this situation, a command signal istransmitted from the antenna coil 71, the control unit 81 of the RF tag8 deciphers the command indicated by the command signal to execute theinstructed processing, then generates a signal (response signal)indicating predetermined response data, and transmits the generatedsignal back to the reader/writer 3.

In the receiving circuit 33, the band-pass filter circuit 51 performsnoise removal, and then the detector circuit 52 extracts a carrier waveincluding the response signal. Furthermore, the low-pass filter circuit53 extracts the response signal of the tag 8 from the carrier wave, theamplifier circuit 54 amplifies the extracted response signal, and thenthe comparator 55 converts the amplified response signal into arectangular signal. Using the signal input by the comparator 55, thecontrol unit 31 deciphers the content of the response of the tag 8, andoutputs communication result data including this deciphered data to thecommunication I/F 35.

The detector circuit 61 of the reception level detecting circuit 34receives an input of the same response signal as the signal that isinput to the comparator 55, and generates an envelope signal indicatingchanges in the levels of peaks of the response signal. The A/Dconversion circuit 62 converts this envelope signal into a digitalsignal. The digital data obtained by this conversion is input to thecontrol unit 31 as a reception level of the response signal.

As shown in FIG. 3, the RF tag 8 includes an antenna unit 90 and awireless communication IC (wireless communication device) 80. The RF tag8 of this type may be, for example, a passive type tag or an active typetag.

The antenna unit 90 converts electric waves received from thereader/writer 3 into wireless signals so as to transmit the wirelesssignals to the wireless communication IC 80, and converts wirelesssignals from the wireless communication IC 80 into electric waves so asto transmit the electric waves to the reader/writer 3. The antenna unit90 includes an antenna coil (not shown).

Based on a signal received from the reader/writer 3 via the antenna unit80, the wireless communication IC 80 stores data from the reader/writer3 or transmits stored data to the reader/writer 3 via the antenna unit80. This wireless communication IC 80 includes, as shown in FIG. 3, thecontrol unit 81, a flash memory 82, a wireless processing unit 83, andan electric power supply unit 84.

The control unit 81 performs overall control of the operations of theunits of the wireless communication IC 80. The control unit 81 includesa logic operation circuit, a register, and the like, and functions as acomputer. As described above, the flash memory 82 is a nonvolatilememory having a plurality of blocks serving as units of erasure. Theflash memory 82 stores programs and data.

The wireless processing unit 83 converts wireless signals received fromthe outside via the antenna unit 90 into their original form so as totransmit the converted data to the control unit 81, and converts datareceived from the control unit 81 into a form suitable for wirelesstransmission so as to transmit the converted wireless signal to theoutside via the antenna unit 90. In the wireless processing unit 83, forexample, an A/D (Analog to Digital) conversion circuit, a D/A (Digitalto Analog) conversion circuit, a modulation and demodulation circuit, anRF circuit, and the like are used.

The electric power supply unit 84 rectifies the inductive voltage thatis generated by the antenna unit 90 receiving an electric wave in arectifier circuit so as to regulate the inductive voltage to apredetermined voltage in an electric power supply circuit, and thensupplies the regulated voltage to the units of the wirelesscommunication IC 80.

Based on the command signal received from the reader/writer 3 via theantenna unit 90 and the wireless processing unit 83, the control unit 81stores the data received from the reader/writer 3 into the flash memory82, or reads data stored in the flash memory 82 so as to transmit theread data to the reader/writer 3 via the wireless processing unit 83 andthe antenna unit 90.

FIG. 4 is a block diagram illustrating an example of a hardwareconfiguration of the host device 1 according to the embodiment of thepresent invention. FIG. 4 shows a hardware configuration of the hostdevice 1 that is a general-purpose personal computer.

The host device 1 includes a CPU 10 for executing various types ofcalculation processing, a ROM 11 in which various types of data andprograms are stored, a RAM 12 in which operation data and the like arestored, an operation unit 13 for accepting instructions from the user, adisplay unit 14 for displaying various types of information, a hard disk15 in which various types of data and programs are recorded, acommunication I/F 16 for performing communication with the reader/writer3 is performed, and a drive device 17 capable of reading/writing dataand programs from/into a recording medium 17 a. The recording medium 17a may be, for example, an optical medium such as a CD-ROM (CompactDisc-ROM), a memory card, or the like.

Functional Configuration

The following will describe a functional configuration of the RFIDsystem SYS according to the present embodiment.

FIG. 5 is a functional block diagram illustrating a functionalconfiguration of the RFID system SYS according to the embodiment of thepresent invention. As shown in FIG. 5, the reader/writer 3 includes, asits functions, a command receiving unit 301, a detection processing unit302, a specifying unit 303, a backup processing unit 304, a writingprocessing unit 305, a notification unit 306, and a writing-backprocessing unit 307. Furthermore, the RF tag 8 includes, as itsfunction, a storage processing unit 810 that controls reading/writing ofdata from/into the flash memory 82.

The command receiving unit 301 of the reader/writer 3 receives commandsfrom the host device 1. In the present embodiment, commands transmittedfrom the host device 1 encompass a writing command and a restorationcommand. The writing command includes, for example, identificationinformation (hereinafter, referred to as “tag ID”) for the RF tag 8, andaddress information of the flash memory 82 that indicates a writingrange. The command receiving unit 301 is realized by the communicationI/F 35.

When the command receiving unit 301 has received the above-describedcommand, that is, a writing command and a restoration command, thedetection processing unit 302 executes detection processing fordetecting the RF tag 8. Furthermore, the detection processing unit 302acquires the tag ID of the detected RF tag 8. The tag ID is stored in,for example, the flash memory 82 of the RF tag 8.

Upon reception of a writing command by the command receiving unit 301,the specifying unit 303 specifies, from among blocks to which thewriting range belongs, the block that includes data outside the writingrange. Hereinafter, the processing of the specifying unit 303 willspecifically be described with reference to FIG. 6.

FIG. 6 is a diagram schematically illustrating the relationship betweena writing range and the block configuration of the flash memory 82provided in the RF tag 8 according to the embodiment of the presentinvention. As shown in FIG. 6, the flash memory 82 includes, forexample, a plurality of blocks BL1, BL2, . . . , BL6. Each block isconstituted by a plurality of bytes. For example, when a new data stringdenoted by data D2, D3, and D4 is written into the flash memory 82, thewriting range corresponds to a hatched area of FIG. 6. Morespecifically, the writing range is the area bounded by a startingaddress and an ending address of this data string. The new data D2 iswritten into a partial area of the block BL2, the new data D3 is writteninto the entire area of the block BL3, and the new data D4 is writteninto a partial area of the block BL4. Since, in this case, blocks 820 towhich the writing range belongs are the blocks BL2 to BL4, thespecifying unit 303 specifies, from among the blocks BL2 to BL4, theblocks BL2 and BL4 as such blocks that include data outside the writingrange. These blocks BL2 and BL4 are blocks having the possibility of adata loss due to erasure of data outside the writing range. This isbecause both original data D1, which is located outside the writingrange, in the block BL2, and original data D5, which is located outsidethe writing range, in the block BL4 are first erased before writing ofdata by the writing processing unit 305, which will be described later.In the present embodiment, the data that is written in units of a blockafter initialization of a block is referred to as “update data”. Forexample, in the case of the block BL2, the original data D1 and the newdata D2 are collectively referred to as update data.

Note that these blocks are hereinafter referred to as “divided blocks”,because data is written only into a part thereof. Furthermore, anotherblock included in the writing range is referred to as a “normal block”.When the writing range extends over a plurality of blocks, the dividedblocks are the block at the start and the block at the end. When thewriting range belongs only to a single block and this block is assumedto be defined also as the block at the start, the divided block is thisblock at the start. Note that, although it is rarely the case, it isconceivable that data is to be written into the entire blocks even ifthese blocks serve as the block at the start and as the block at theend. In this case, however, by defining the block at the start and theblock at the end as divided blocks, it is possible to simplify theprocessing. Note that processing for extracting, from among the block atthe start and the block at the end, only the block that actuallyincludes data outside the writing range may also be performed.

As shown again in FIG. 5, the backup processing unit 304 performsprocessing for backing up original data in the divided blocks. Theoriginal data to be backed up is the entire data of the divided blocks.Note that only data outside the writing range may be backed up since theoriginal data in the writing range is rewritten to new data. The backupprocessing unit 304 stores backup data including the original data andaddress information of the original data, as restoration information 360in the storage unit 36. The backup data is stored in association withthe tag ID acquired by the detection processing unit 302. Therestoration information 360 is needed at the time of writing-back of theoriginal data. An example of a data structure of the restorationinformation 360 will be described later.

The writing processing unit 305 executes processing for writing new data(update data) into the flash memory 82 of the RF tag 8 in response to awriting command received by the command receiving unit 301. In the caseof writing into a normal block, new data (update data) is written intothe initialized normal block without reading the data from the normalblock. For example, when data is written into the block BL3 of FIG. 6,the entire data of the block BL3 is rewritten to the new data D3. Theinitialization of the normal block is performed on the storageprocessing unit 810 side of the RF tag 8 before writing of the new datawhen, for example, a writing command is transmitted from the writingprocessing unit 305. The writing command transmitted from thereader/writer 3 to the RF tag 8 includes, for example, the new data D3and address information of the flash memory 82. Note that the writingprocessing unit 305 may give a block initialization instruction and anupdate data writing instruction, separately.

On the other hand, in the case of writing of data into a divided block,the writing processing unit 305 writes the update data into theinitialized divided block after the backup data is stored in the storageunit 36. For example, when data is written into the block BL2 of FIG. 6,the entire original data of the block BL2 is first read out. Then,update data that is obtained by merging the read entire data and the newdata D2 is written into the initialized block BL2. Accordingly, theoriginal data D1 outside the writing range is written back again to thesame position. In order to read out the original data of the block BL2,the writing processing unit 305 needs only to transmit a reading commandto the RF tag 8. This reading command includes, for example, addressinformation of the flash memory 82. By the storage processing unit 810of the RF tag 8 reading the entire data from the block BL2 of the flashmemory 82 based on the received reading command and sending back theread data, it is possible for the writing processing unit 305 to acquirethe original data of the divided block. Note that initialization of thedivided block as well may be performed by the same procedure as that inthe above-described case of the normal block.

Since, as described above, the writing processing unit 305 first readsthe entire data of the divided block, it is advantageous that the backupprocessing unit 304 backs up the data of the divided block read by thewriting processing unit 305, in view of efficiency.

The notification unit 306 performs notification of error information ifrewriting of data of divided and normal blocks has failed. Particularly,if rewriting of data of the divided block has failed, notification oferror information indicating a possible data loss is performed. In thepresent embodiment, the notification unit 306 notifies the host device 1of the error information as a writing result. In this case, thenotification unit 306 is realized by, for example, the communication I/F35. Note that the notification unit 306 may be realized by its displayunit 38 because it is sufficient for the user to be notified of the dataloss. For example, the user may be notified of the data loss by thedisplay unit 38 lighting in a predetermined color.

The writing-back processing unit 307 reads back up data stored as therestoration information 360 in the storage unit 36 if the writing into adivided block has failed. The entire original data is written back intothe divided block whose data was lost.

Note that in the functional configuration of the reader/writer 3 shownin FIG. 5, the functions of the detection processing unit 302, thespecifying unit 303, the backup processing unit 304, and the writingprocessing unit 305 may be realized by the control unit 31 shown in FIG.2 executing software. It is also possible that at least one of thefunctions is realized by hardware. Alternatively, the function of thestorage processing unit 810 of the RF tag 8 may be realized by thecontrol unit 81.

Example of Data Structure

FIG. 7 is a diagram illustrating an example of a data structure of therestoration information 360 according to the embodiment of the presentinvention. As shown in FIG. 7, the restoration information 360 includesa plurality of pieces of restoration data R1, R2, . . . Each piece ofrestoration data includes communication time and date, a tag ID, addressinformation, and original data. The communication time and date may be,for example, the time and date at which the tag 8 was detected by thedetection processing unit 302, or the time and date at which theoriginal data was read. The tag ID is the identification information ofthe tag 8 that was acquired by the detection processing unit 302. As theaddress information, for example, a starting address and a byte count(size) are stored. The original data is the entire data of a dividedblock that was read by the writing processing unit 305. Accordingly, inthe present embodiment, the address information and the original data,which constitutes the backup data, are stored in association with thecommunication time and date and the tag ID. As long as the backup datais associated with the communication time and date and the tag ID, aconfiguration in which all these items are included in one restorationdata is not essential.

<About Operation>

Hereinafter, the operation of the RFID system SYS according to thepresent embodiment will specifically be described.

Data Writing Processing

FIG. 8 is a flowchart illustrating data writing processing that isperformed by the reader/writer 3 according to the embodiment of thepresent invention. Note that the processing procedure shown in FIG. 8 isstored in advance as a program in the storage unit 36, and the datawriting processing is realized by the control unit 31 reading andexecuting the program. Furthermore, the data writing processing startswhen the writing command from the host device 1 is received by thecommand receiving unit 301.

As shown in FIG. 8, the detection processing unit 302 first executesprocessing for detecting the RF tag 8 (step S (hereinafter, abbreviatedas “S”) 2). When the RF tag 8 is detected, the tag ID of the RF tag 8 isacquired (S4).

The specifying unit 303 determines, based on the address informationincluded in the writing command, whether or not a writing destinationblock is a divided block (S6). The writing destination block is one ofone or more blocks to which the writing range belongs. In the presentembodiment, the block at the start and the block at the end aredetermined as divided blocks.

If it is determined that the writing destination block is a dividedblock (YES in S6), the writing processing unit 305 reads the entire dataof the divided block (S8). After this processing, the writing processingunit 305 notifies the backup processing unit 304 of the completion ofreading. On the other hand, if it is determined that the writingdestination block is not a divided block (NO in S6), the procedureadvances to S22.

After the processing in S8, the backup processing unit 304 copies theentire data of the read divided block and backs up the entire data(S10). That is, new restoration data is added to the storage unit 36 sothat the restoration information 360 is updated. This restoration dataincludes, as shown in FIG. 7, the entire data (original data) read asbackup data in S8 and its address information, the data on the time anddate at which the RF tag 8 was detected in S2, and the tag ID acquiredin S4.

When the backup processing is completed, the backup processing unit 304notifies the writing processing unit 305 of the completion of backup.Accordingly, the writing processing unit 305 transmits a writing commandto the RF tag 8 so as to execute processing for rewriting the data ofthe divided block. Specifically, the writing processing unit 305 mergesthe data of the divided block that was read in S8 and new data, andwrites the merged update data into the initialized divided block (S12).Since here, on the RF tag 8 side, the block is initialized only after awriting command is received, the original data of a divided block cannotfail to be backed up before the initialization thereof, according to thepresent embodiment. When the writing of the received data into thedivided block of the flash memory 82 is completed, the storageprocessing unit 810 of the RF tag 8 sends response informationindicating a successful writing back to the reader/writer 3.

If the response information indicating a successful writing is notreceived within, for example, a predetermined time period, the writingresult is determined as failed (“Failed” in S14) and the writingprocessing in S12 is retried (“NO” in S16). If the response informationindicating a successful writing is received within the predeterminedtime period (“Successful” in S14), the procedure advances to S30. In thecase of a successful writing, the restoration data generated in thebackup processing in S10 is preferably deleted from the restorationinformation 360 (S15).

If the number of retries exceeds an acceptable value (“YES” in S16), thenotification unit 306 notifies the host device 1 of a data loss (S18).Specifically, error information indicating that writing has failed dueto a communication error and there is the possibility of a data loss issent back to the host device 1 as a writing result. Here, the errorinformation may include the restoration data generated by the backupprocessing in S10. The operation of the host device 1 that has receivedthe error information will be described later as error notificationprocessing.

In S22, the writing processing unit 305 writes new data into a normalblock by, for example, a well-known method. Also in this case, if theresponse information indicating a successful writing is not receivedfrom the RF tag 8 within, for example, a predetermined time period, thewriting result is determined as failed (“Failed” in S24) and the writingprocessing in S22 is retried (“NO” in S26). If the response informationindicating a successful writing is received within the predeterminedtime period (“Successful” in S24), the procedure advances to S30.

If the number of retries exceeds an acceptable value (“YES” in S26), thenotification unit 306 notifies the host device 1 of a writing failuredue to a communication error (S28). Specifically, error informationindicating that writing has failed due to a communication error is sentback to the host device 1, as a writing result.

In S30, the control unit 31 determines whether or not writing iscompleted. That is, it is determined whether or not the writingprocesses with respect to all blocks to which the writing range belongsare completed. If the writing is not completed (“NO” in S30), theprocedure returns to S6, and the above-described processing is repeated.If the writing is completed (“YES” in S30), a writing result indicatingthe successful writing is sent back to the host device 1, and the seriesof data writing processing end.

Error Notification Processing

FIG. 9 is a flowchart illustrating error notification processing that isexecuted in the host device 1 according to the embodiment of the presentinvention. Note that the processing procedure shown in FIG. 9 is storedin advance as a program in, for example, the hard disk 15, and the datanotification processing is realized by the CPU 10 reading and executingthe program. Furthermore, the data notification processing starts whenerror information is received as a writing result from the reader/writer3.

As shown in FIG. 9, the CPU 10 determines whether or not the receivederror information is a data loss error (S102). If the received errorinformation is a simple communication error (“NO” in S102), a writingfailure due to a communication error is displayed on the display unit 14(S110).

On the other hand, if the received error information is a data losserror (“YES” in S102), the CPU 10 displays, on the display unit 14, awriting failure due to a communication error and the possibility of adata loss (S104). If the error information includes the restorationdata, the communication time and date, the tag ID, the addressinformation, and the original data may be displayed in association withthat restoration data. Furthermore, a table as shown in FIG. 7 thatincludes previous restoration data may be displayed. A restorationbutton for accepting a restoration instruction may further be displayedon the display unit 14.

If a restoration instruction is input by operation of the operation unit13 (“YES” in S106), the CPU 10 transmits a restoration command to thereader/writer 3 that has transmitted the error information (S108). Inthe present embodiment, because the user is notified that the data losswas caused due to a communication error, the user can give therestoration instruction after he or she performed a correction of theposition of the RF tag 8. Therefore, in the restoration processing,which will be described later, it is possible to appropriately restorethe erased data. Note that if previous restoration information isdisplayed together, it is assumed that the user selects the data to berestored and then inputs the restoration instruction. In this case, therestoration command includes information (for example, the communicationtime and date) for specifying the target restoration data (backup data).

The operation of the reader/writer 3 that has received the restorationcommand will be described hereinafter as restoration processing.

Restoration Processing

FIG. 10 is a flowchart illustrating restoration processing that isexecuted by the reader/writer 3 according to the embodiment of thepresent invention. Note that the processing procedure shown in FIG. 10is stored in advance as a program in the storage unit 36, and therestoration processing is realized by the control unit 31 reading andexecuting the program. Furthermore, the restoration processing startswhen the restoration command from the host device 1 is received by thecommand receiving unit 301.

As shown in FIG. 10, the writing-back processing unit 307 first readsthe restoration data that corresponds to the restoration command fromthe restoration information 360 of the storage unit 36 (S202). That is,the tag ID of the RF tag 8 that is to be restored, the original data,and the address information of the original data are read out. Note thatif the restoration command includes no information for specifying therestoration data, for example, the latest restoration data may be readout among the restoration information 360.

Then, the detection processing unit 302 executes processing fordetecting the RF tag 8 (S204). Upon detection of the RF tag 8, the tagID thereof is acquired (S206). The writing-back processing unit 307determines whether or not the acquired tag ID and the read tag IDcorrespond to each other (S208). If they correspond to each other (“YES”in S208), the read original data is written back into the block that wasspecified based on the read address information (S210). Accordingly, itis possible to completely restore the data of a divided block whose dataoutside the writing range is lost. If data is written back, therestoration data that was written back is deleted from the restorationinformation 360 (S212).

When the writing-back of the original data is completed, thenotification unit 306 notifies the host device 1 of the completion ofthe restoration (S214). The host device 1 that was notified of thecompletion of the restoration displays this on the display unit 14, andpreferably deletes the restoration data used for the restoration if therestoration information is held also in the hard disk 15.

Furthermore, by the host device 1 that was notified of the completion ofthe restoration transmitting again a writing command to thereader/writer 3, it is possible to execute again the data writingprocessing shown in FIG. 8. As a result, it is possible to appropriatelywrite the update data (original data and new data) into the RF tag 8.

If it is determined in S208 that tag IDs do not match each other (“NO”in S208), the notification unit 306 notifies the host device 1 of theinconsistency of the tag IDs (S216).

Note that also in the writing-back processing in S210, as with in thedata writing processing shown in FIG. 8, an acceptable number of retriesmay be provided, and if the number of retries exceeds an acceptablenumber, the host device 1 may be notified of a restoration failure.

As described above, according to the present embodiment, the originaldata of a divided block is backed up in the reader/writer 3, and thuseven if an unintended data loss occurs, a user can write the originaldata back into the flash memory 82 only by inputting a restorationinstruction to the host device 1. Therefore, it is possible to prevent acomplete data loss by a simple method without changing the hardwareconfiguration of the RF tag 8 or the environment of the system.

Note that a method in which data of all blocks to which a writing rangebelongs is read in advance and backed up is also conceivable as anotherhandling method on the application side. However, when the writing rangeis large, such a method is inefficient because it takes a lot of troublewith reading. In contrast, according to the present embodiment, onlydivided blocks serve as backup targets and reading processing that isperformed in a well-known writing processing is used, and thus it ispossible to efficiently back up the data that may be going to be erased.

Modification

While the above-described embodiment relates to how to deal with a dataloss when communication is interrupted during writing of data into adivided block, the present modification can also address a data losswhen a momentary power interruption of the reader/writer 3 occurs.Momentary power interruption refers to the case where the electric powersupply is temporarily interrupted during the operation of thereader/writer 3.

In the present modification, the storage unit 36 holds predeterminedinformation while writing processing with respect to a divided block inthe reader/writer 3 is performed by the writing processing unit 305. Thepredetermined information refers to information indicating that writinginto a divided block is in progress (the reading is completed). In thepresent modification, by, for example, turning a writing flag of thestorage unit 36 ON, the information indicating that writing into adivided block is in progress is stored in a nonvolatile manner. Datawriting processing using the writing flag will be described withreference to FIG. 11.

FIG. 11 is a flowchart illustrating data writing processing that isexecuted by the reader/writer 3, according to the modification of theembodiment of the present invention. In FIG. 11, the same step numbersare given to the same processes as those shown in FIG. 8. Therefore,descriptions thereof are not repeated.

As shown in FIG. 11, in the present modification, new S11 is addedbetween S10 (backup processing) and S12 (writing processing) that areshown in FIG. 8. In S11, the control unit 31 turns the writing flag ON.Note that in the present modification, the writing flag is set to OFF atthe start of the data writing processing.

Furthermore, new S20 is added between S15 (restoration data deletion)and S30 (determination of the writing end) that are shown in FIG. 8. InS20, the control unit 31 turns the writing flag OFF. Furthermore, newS17 is added between S16 (the number of retries exceeding an acceptablevalue) and S18 (notification of a data loss) of FIG. 8. Also in S17, thecontrol unit 31 turns the writing flag OFF.

Accordingly, in the present embodiment, the writing flag is set to ONonly during the writing of data into a divided block (S12, S14, andS16). Therefore, if a momentary power interruption of the reader/writer3 occurs during the writing, the writing flag of the storage unit 36will remain in the ON state.

The following will describe processing for starting reader/writer 3 whenan electric power is again supplied after the momentary powerinterruption.

FIG. 12 is a flowchart illustrating processing for starting thereader/writer 3 according to the modification of the embodiment of thepresent invention. Note that the processing shown in FIG. 12 as well isstored in advance as a program in the storage unit 36, and the startprocessing is realized by the control unit 31 reading and executing theprogram.

As shown in FIG. 12, the control unit 31 first checks the writing flagof the storage unit 36 (S302). If the writing flag is set to OFF (“OFF”in S304), the procedure advances to normal start processing (S310).Whereas, if the writing flag is set to ON (“ON” in S304), the hostdevice 1 is notified of a data loss (S306). Here, error informationindicating a writing failure due to a system crash and the possibilityof a data loss is sent back as a writing result to the host device 1.Then, the writing flag is turned OFF (S308), and the procedure advancesto the normal start processing (S310).

Up on reception of the error information notified in S306, the hostdevice 1 displays, on the display unit 14, the possibility of a dataloss and a writing failure due to a system crash. When previousrestoration information as well is displayed on the display unit 14, itis preferable to display the respective pieces of original data suchthat they are distinguished as to whether it is data lost by acommunication error or data lost by a system crash.

In the foregoing embodiment and its modification, it is also possible toprovide the processes (data writing method and the like) shown in therespective flowcharts as programs. Such programs can be provided in thestate of being recorded in an optical medium such as a CD-ROM ornon-transitory computer-readable recording medium such as a memory card.Furthermore, the programs can be provided by downloading via a network.

The programs (data writing program and the like) that are executed inthe reader/writer 3 can be transmitted, for example, from the hostdevice 1 via the communication I/F 35, and the reader/writer 3 canupdate the program stored in the storage unit 36 with a receivedprogram.

Note that a program according to the present invention may be such that,of program modules provided as a part of an operating system (OS) of thecomputer, required modules are called in a predetermined arrangement ata predetermined timing and the called modules execute the processing. Inthis case, the program itself does not include the above-describedmodules, and the processing is performed in cooperation with the OS. Aprogram that does not include such modules can be included in theprogram according to the present invention.

Furthermore, a program according to the present invention may beprovided in the state of being incorporated into a part of anotherprogram. Also in this case, the program itself does not include themodules that are included in the other program, and processing isexecuted in cooperation with the other program. Such a program that isincorporated into another program can also be included in the programaccording to the present invention.

The embodiments disclosed here are in all respects exemplary and are notconstrued as restrictive. The scope of the present invention isindicated not by the description above but rather by the Claims, andencompasses all modifications in the meaning and scope equivalent to theClaims.

INDEX TO THE REFERENCE NUMERALS

1 . . . Host device, 2 . . . Hub, 3 . . . RF tag, 8 . . . RF tag, 10 . .. CPU, 11 . . . ROM, 12 . . . RAM, 13 . . . Operation unit, 14 . . .Display unit, 15 . . . Hard disk, 16, 35 . . . Communication I/F, 17 . .. Drive device, 30 . . . Communication control device, 31, 81 . . .Control unit, 32 . . . Transmitting circuit, 33 . . . Receiving circuit,34 . . . Reception level detecting circuit, 36 . . . Storage unit, 37 .. . Timer unit, 38 . . . Display unit, 39 . . . Electric power supplyunit, 70 . . . Antenna unit, 71 . . . Antenna coil, 80 . . . Wirelesscommunication IC, 82 . . . Flash memory, 83 . . . Wireless processingunit, 84 . . . Electric power supply unit, 90 . . . Antenna unit, 301 .. . Command receiving unit, 302 . . . Detection processing unit, 303 . .. Specifying unit, 304 . . . Backup processing unit, 305 . . . Writingprocessing unit, 306 . . . Notification unit, 360 . . . Restorationinformation, 810 . . . Storage processing unit, SYS . . . RFID system

The invention claimed is:
 1. A communication device that performscontactless communication with an RF tag that is provided with anonvolatile memory having a plurality of blocks serving as units of dataerasure of original data to be initialized by data erasure before updatedata is to be written thereto, the communication device comprising: aspecifying unit that specifies, from among the plurality of blocks thatinclude a writing range of the update data, a block that includes theoriginal data that is outside the writing range of the update data whenthe update data is written into the nonvolatile memory; a backupprocessing unit that backs up the original data of the block specifiedby the specifying unit; a storage unit that stores backup data thatincludes the original data; and a writing processing unit that writes,when the backup data is stored in the storage unit, the update data intothe block that was specified and initialized.
 2. The communicationdevice according to claim 1, wherein the original data included in thebackup data is data that is read by the writing processing unit from thespecified block before the initialization.
 3. The communication deviceaccording to claim 1, further comprising: a writing-back processing unitthat reads the backup data stored in the storage unit and writes theoriginal data back into the specified block of the nonvolatile memory,if writing into the specified block has failed.
 4. The communicationdevice according to claim 3, further comprising: a notification unitthat performs, if writing into the specified block has failed,notification of error information indicating a possibility of a dataloss, wherein the writing-back processing unit writes the original databack into the specified block in response to a writing-back instructionfrom a user.
 5. The communication device according to claim 4, furthercomprising: an electric power supply unit, wherein the storage unitfurther stores predetermined information during writing processing bythe writing processing unit, the notification unit further performs,when the electric power supply unit is turned on, notification of theerror information if the predetermined information is stored in thestorage unit.
 6. The communication device according to claim 5, whereinthe notification unit performs notification of the error informationsuch that a data loss caused by a communication failure and a data losscaused by an electric power interruption are distinguished from eachother.
 7. The communication device according to claim 4, wherein thenotification unit transmits the error information to a host deviceconnected by a cable or wireless connection.
 8. The communication deviceaccording to claim 3, further comprising: a detection unit that detectsthe RF tag, and acquires identification information of the detected RFtag, wherein the backup processing unit stores the identificationinformation of the RF tag and the backup data in association with eachother, and the writing-back processing unit writes the original databack into the specified block in response to a writing-back instruction,if the identification information of the detected RF tag and theidentification information associated with the backup data match eachother.
 9. An RFID system comprising: a communication device thatperforms contactless communication with an RF tag that is provided witha nonvolatile memory having a plurality of blocks serving as units ofdata erasure of original data to be initialized by data erasure beforeupdate data is to be written thereto, the communication devicecomprising: a specifying unit that specifies, from among the pluralityof blocks that include a writing range of the update data, a block thatincludes the original data that is outside the writing range of theupdate data when the update data is written into the nonvolatile memory;a backup processing unit that backs up the original data of the blockspecified by the specifying unit; a storage unit that stores backup datathat includes the original data; and a writing processing unit thatwrites, when the backup data is stored in the storage unit, the updatedata into the block that was specified and initialized; and the RF tag.10. The RFID system according to claim 9, wherein the original dataincluded in the backup data is data that is read by the writingprocessing unit from the specified block before the initialization. 11.The RFID system according to claim 9, wherein the communication devicefurther comprises: a writing-back processing unit that reads the backupdata stored in the storage unit and writes the original data back intothe specified block of the nonvolatile memory, if writing into thespecified block has failed.
 12. The RFID system according to claim 11,wherein the communication device further comprises: a notification unitthat performs, if writing into the specified block has failed,notification of error information indicating a possibility of a dataloss, wherein the writing-back processing unit writes the original databack into the specified block in response to a writing-back instructionfrom a user.
 13. The RFID system according to claim 12, wherein thecommunication device further comprises: an electric power supply unit,wherein the storage unit further stores predetermined information duringwriting processing by the writing processing unit, the notification unitfurther performs, when the electric power supply unit is turned on,notification of the error information if the predetermined informationis stored in the storage unit.
 14. The RFID system according to claim13, wherein the notification unit performs notification of the errorinformation such that a data loss caused by a communication failure anda data loss caused by an electric power interruption are distinguishedfrom each other.
 15. The RFID system according to claim 12, wherein thenotification unit transmits the error information to a host deviceconnected by a cable or wireless connection.
 16. The RFID systemaccording to claim 11, wherein the communication device furthercomprises: a detection unit that detects the RF tag, and acquiresidentification information of the detected RF tag, wherein the backupprocessing unit stores the identification information of the RF tag andthe backup data in association with each other, and the writing-backprocessing unit writes the original data back into the specified blockin response to a writing-back instruction, if the identificationinformation of the detected RF tag and the identification informationassociated with the backup data match each other.
 17. A recording mediumhaving a data writing program for writing data into a nonvolatile memoryof an RF tag recorded thereon, the nonvolatile memory having a pluralityof blocks serving as units of data erasure of original data to beinitialized by data erasure before update data is to be written thereto,the data writing program being executed by a communication device thatperforms contactless communication with the RF tag, the data writingprogram causing a processor of the communication device to performoperations comprising: specifying, from among the plurality of blocksthat include a writing range of the update data, a block that includesthe original data that is outside the writing range of the update datawhen the update data is written into the nonvolatile memory; storingbackup data that includes the original data of the specified block intoa storage unit; and writing, when the backup data is stored in thestorage unit, the update data into the block that was specified andinitialized.
 18. The recording medium according to claim 17, wherein thedata writing program causes the processor of the communication device toperform operations further comprising: reading the backup data stored inthe storage unit and writing the original data back into the specifiedblock of the nonvolatile memory, if writing into the specified block hasfailed.
 19. The recording medium according to claim 18, wherein the datawriting program causes the processor of the communication device toperform operations further comprising: if writing into the specifiedblock has failed, providing a notification of error informationindicating a possibility of a data loss, and writing the original databack into the specified block in response to receiving a writing-backinstruction.
 20. The recording medium according to claim 18, wherein thedata writing program causes the processor of the communication device toperform operations further comprising: detecting the RF tag, acquiringidentification information of the detected RF tag, storing theidentification information of the RF tag and the backup data inassociation with each other, and writing the original data back into thespecified block in response to a writing-back instruction, if theidentification information of the detected RF tag and the identificationinformation associated with the backup data match each other.